package cn.kailangtu.dataspot.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.util.Log;

import cn.kailangtu.dataspot.AppBasicMethod;
import cn.kailangtu.dataspot.MainActivity;
import cn.kailangtu.dataspot.activify.SplashActivity;

public class BootCompletedReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
            Log.e("收到开机广播", "程序自启");

            //Toast.makeText(context, "程序自启中...", Toast.LENGTH_LONG).show();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    //SystemClock.sleep(KLTConfig.APP_START_WAITTIME * 1000);
                    AppBasicMethod.getInstance().startApp();
                }
            }).start();

           // context.startActivity(new Intent(context, SplashActivity.class));
        } else if (action.equals("com.hetunai.htservice.Nofity")) {
            Log.e("收到开机广播", "com.hetunai.htservice.Nofity");

        } else {
            Log.e("收到开机广播", action);

        }
    }
}
